//
//  ExitDiscussion.m
//  HiQ
//
//  Created by maxwellpang on 12-8-12.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "ExitDiscussion.h"
#import "Connection.h"
#import "MacrosDefine.h"

@implementation ExitDiscussion

@synthesize delegate;

-(void) onExitDiscussion:(NSUInteger)groupID UserID:(NSUInteger)userId
{
    NSMutableData *data = [[NSMutableData alloc] initWithBytes:&groupID length:sizeof(NSUInteger)];
    [data appendBytes:&userId length:sizeof(NSUInteger)];
    
    [[Connection sharedServerConnection] sendData:data cmd:CMD_FUN_GROUP subcmd:CMD_GROUP_EXIT_REQUEST];
}

-(void) onReceiveExitDiscussion:(NSData*) data
{
    void *bytes = (void*)([data bytes]+16);
    NSUInteger groupId = *((NSUInteger*)bytes);
    NSUInteger userId = *((NSUInteger*)(bytes+8));
    
    [delegate onExitDiscussionInfo:groupId UserID:userId];
}
@end
